<?php

namespace App\Http\Requests\Home\UserAddress;

use Illuminate\Foundation\Http\FormRequest;

class UserAddressCreate extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 定义表单规则
     *
     * Date: 13/04/2018
     * @author Tenny
     * @return array
     */
    public function rules()
    {
        return [
            'uid' => 'required|Integer',
            'name' => 'required',
            'phone' => 'required',
            'provice_id' => 'required|Integer',
            'city_id' => 'required|Integer',
            'county_id' => 'required|Integer',
            'address' => 'required',
            'tag' => 'nullable',
        ];
    }

    /**
     * 定义错误响应消息
     *
     * Date: 13/04/2018
     * @author Tenny
     * @return array
     */
    public function messages()
    {
        return [
            'uid.required' => '请上传uid',
            'uid.Integer' => 'uid必须为数字',
            'name.required' => '请输入姓名',
            'phone.required' => '请输入联系方式',
            'address.required' => '请输入地址',
        ];
    }
}
